home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-09 | 1.6 KB | 50 lines | [TEXT/tefi] |
- ; @(;)Copyright Apple Computer 1987 Version 1.2 of sigcode.s on 87/11/11 20:20:38 2.1.1.1
-
- ; aux_sigcode: the interface routine to user's signal handlers.
-
- ; The kernel forces the entry to _sigcode with the stack thus:
- ;
- ; ---- ; tabu area: the user's stack
- ; long PC ; user's program counter
- ; short CC,kind ; user's condition codes, stack format flag
- ; long arg ; second argument
- ; long signo ; first argument. This is the top of the stack.
-
- ; aux_sigcode does this:
- ;
- ; 1) save those registers that wouldn't be saved by the user's signal handler
- ;
- ; 2) call aux_sigcall(signo, arg) to call the user's signal handler
- ;
- ; 3) restore the registers
- ;
- ; 4) Pop the stack so that the kernel's stuff is gone,
- ; at the same time restoring the condition codes and pc.
- ; This effects a return to the user's interrupted program.
-
- export aux_sigcode
- import aux_sigcall
- import aux_sysm68k
-
- aux_sigcode proc
- link a6,#-20 ; push a6; set a6 to sp; decr sp by 5 longs
- movem.l d0-d1/a0-a1,-16(a6) ; save a1-a0, d1-d0
- move.l 8(a6),(sp) ; "push" arg
- move.l 4(a6),-(sp) ; push signo
- jsr aux_sigcall ; call aux_sigcall(signo, arg)
- movem.l -16(a6),d0-d1/a0-a1 ; restore a1-a0, d1-d0
- unlk a6 ; restore a6, sp
- tst.w 8(sp) ; look at the kind flag in the pad word
- beq.b Lnormal ; 0 means 'rtr' is usable
- ;
- ; at this point we need to call the kernel to perform instr cont for us
- ;
- add.w #8,sp ; pop signo, arg
- move.l d0,-(sp) ; arg1 - old d0 value
- move.l #2,-(sp) ; cmd - instruction continue
- jsr aux_sysm68k ; no return
- Lnormal add.w #10,sp ; pop signo, arg and stack format word
- rtr ; pop CC into cc, pop PC into pc
- endp
-
- end